function splitipnet(obj) {
  var tr = $(obj).parent().parent();
  var ipnet_name = tr.children("td#ipnet_name").text();
  var ipnet_split = tr.children("td#ipnet_split").text();
  if (ipnet_split=="否")
     {
      $('#splitipnet_name').val(ipnet_name);
      $('#ipnetsplitModal').modal('show');
     }
  else
     {
     $('#ipnetspliterrModal').modal('show');
     }
};

function delipnet(obj) {
    var tr = $(obj).parent().parent();
    var ipnet_name = tr.children("td#ipnet_name").text();
    $('#delipnet_name').val(ipnet_name);
    $('#ipnetdelModal').modal('show');
  };

function addgw(obj) {
    var tr = $(obj).parent().parent();
    var ipnet_name = tr.children("td#ipnet_name").text();
    $('#addgwipnet_name').val(ipnet_name);
    $('#addgwModal').modal('show');
  };

function delconipnet(obj) {
    var tr = $(obj).parent().parent();
    var ipnet_name = tr.children("td#ipnet_name").text();
    $('#delipnet_name').val(ipnet_name);
    $('#delconipnetModal').modal('show');
  };

function editconipnet(obj) {
    var tr = $(obj).parent().parent();
    var ipnet_name = tr.children("td#ipnet_name").text();
    var edit_ipnet_status = tr.children("td#edit_ipnet_status").text();
    var edit_ipnet_type = tr.children("td#edit_ipnet_type").text();
    var edit_ipnet_zone = tr.children("td#edit_ipnet_zone").text();
    var usage = tr.children("td#usage").text();
    var vlan = tr.children("td#vlan").text();
    var ip_a = tr.children("td#ip_a").text();
    var ip_z = tr.children("td#ip_z").text();
    var networkdevice_a = tr.children("td#networkdevice_a").text();
    var networkdevice_z = tr.children("td#networkdevice_z").text();
    var port_a = tr.children("td#port_a").text();
    var port_z = tr.children("td#port_z").text();
    var memo = tr.children("td#memo").text();
    $('#edit_name').val(ipnet_name);       
    if (edit_ipnet_status == "运营") {
      $("#edit_status").val("0");
    } else if (edit_ipnet_status == "待分配") {
      $("#edit_status").val("1");
    } else if (edit_ipnet_status == "已分配") {
      $("#edit_status").val("2");
    } else if (edit_ipnet_status == "保留") {
      $("#edit_status").val("3");
    };  
    if (edit_ipnet_type == "IDC") {
      $("#edit_type").val("0");
    } else if (edit_ipnet_type == "IXP") {
      $("#edit_type").val("1");
    } else if (edit_ipnet_type == "管理") {
      $("#edit_type").val("2");
    };
    if (edit_ipnet_zone == "上海") {
      $("#edit_zone").val("0");
    } else if (edit_ipnet_zone == "北京") {
      $("#edit_zone").val("1");
    } else if (edit_ipnet_zone == "广州") {
      $("#edit_zone").val("2");
    };
    $('#edit_usage').val(usage);
    $('#edit_vlan').val(vlan);
    $('#edit_ip_a').val(ip_a);
    $('#edit_ip_z').val(ip_z);
    $('#edit_networkdevice_a').val(networkdevice_a);
    $('#edit_networkdevice_z').val(networkdevice_z);
    $('#edit_port_a').val(port_a);
    $('#edit_port_z').val(port_z);
    $('#edit_memo').val(memo);
    $('#editconipnetModal').modal('show');
  };
